import request from '@/utils/request'

const USER_BASE_URL = '/user-service/admin/system/sysUser'

export default{
    getRoleListPage(page,limit,searchObj){
        return request({
            url: `${USER_BASE_URL}/${page}/${limit}`,
            method: 'get',
            params:searchObj
        })
    },
    getUserById(id){
        return request({
            url: `${USER_BASE_URL}/get/${id}`,
            method: 'get'
        })
    },
    saveUser(sysUser){
        return request({
            url:`${USER_BASE_URL}/save`,
            method:'post',
            data:sysUser
        })
    },
    updateUser(sysUser){
        return request({
            url: `${USER_BASE_URL}/update`,
            method:'post',
            data:sysUser
        })
    },
    removeUserById(id){
        return request({
            url: `${USER_BASE_URL}/remove/${id}`,
            method:'delete'
        })
    },
    batchRemoveUser(ids){
        return request({
            url: `${USER_BASE_URL}/batchRemove`,
            method:'delete',
            data:ids
        })
    },
    updateStatus(id,status){
        return request({
            url:`${USER_BASE_URL}/updateStatus/${id}/${status}`,
            method:'get'
        })
    },
    getRolesByUserId(userId){
        return request({
            url:`${USER_BASE_URL}/toAssign/${userId}`,
            method:'get'
        })
    },
    saveUserRoles(assignObj){
        return request({
            url:`${USER_BASE_URL}/doAssign`,
            method:'post',
            data:assignObj
        })
    }
}
